#pragma once
#include "lib\macros.h"
#include <string>
#include <vector>
#include <iterator>
#include <utility>


class BaseModel {
public:
  typedef std::vector<std::string>::const_iterator ErrorIter;
  typedef std::pair<ErrorIter, ErrorIter> ErrorType;

  // Constructors and destructor
  BaseModel();
  virtual ~BaseModel();

  // Validation
  virtual bool Validate() =0;

  // Error handling
  virtual void AddError(std::string errormsg);
  ErrorType GetErrors() const;
  bool HasErrors() const;

protected:
  // Accessors
  std::vector<std::string> errors() const;

private:
  std::vector<std::string> errors_;
};